package cn.supermaster.management.web.rest.monitor;

import cn.supermaster.management.common.annotation.Log;
import cn.supermaster.management.common.constant.ModuleConstant;
import cn.supermaster.management.common.enums.BusinessType;
import cn.supermaster.management.common.page.TableDataInfo;
import cn.supermaster.management.common.response.WebResponse;
import cn.supermaster.management.system.domain.SystemUserOnline;
import cn.supermaster.management.web.service.monitor.IMonitorUserOnlineService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName: supermaster-management
 * @Package: cn.supermaster.management.web.rest.monitor
 * @ClassName: MonitorUserOnlineRestController
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2021/1/10 19:17
 * @Version: V1.0
 * @Copyright: 2021 www.super-bytecode.comn Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
@RestController
@RequestMapping("/monitor/online")
public class MonitorUserOnlineRestController {

    @Autowired
    IMonitorUserOnlineService monitorUserOnlineService;

    @RequiresPermissions("monitor:online:list")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public TableDataInfo list(SystemUserOnline userOnline) {
        return monitorUserOnlineService.queryUserOnlineInformations(userOnline);
    }

    @RequiresPermissions(value = {"monitor:online:batchForceLogout", "monitor:online:forceLogout"}, logical = Logical.OR)
    @Log(title = ModuleConstant.MODULE_USER_ONLINE, businessType = BusinessType.FORCE)
    @RequestMapping(value = "/batchForceLogout", method = RequestMethod.POST)
    public WebResponse doBatchForceAccountLogout(String ids) {
        return monitorUserOnlineService.doBatchForceAccountLogout(ids);
    }
}